package org.amicofragile.unitdsl.category;

import org.amicofragile.unitdsl.Unit;

import groovy.util.GroovyTestCase;

class DistanceCategoryTest extends GroovyTestCase {
	public void testSimpleUnitConversion() {
		use (DistanceCategory.class) {
			def oneYdInM = 1.yd.m;
			assertEquals(0.9144, oneYdInM.length, 0.001);
		}
	}
	
	public void testDifferentUnitSum() {
		use (DistanceCategory.class) {
			def oneYdPlusOneM = 1.m + 1.yd;
			assertEquals("Wrong unit after sum", Unit.m, oneYdPlusOneM.unit)
			assertEquals(1.9144, oneYdPlusOneM.length)
		}
	}
}
